clear
set mem 40000
use "U:\schoen\Au�enpolitik\replication_schoen.dta"

*/ 1. Creating variables

*/ a) independent variables 

*/ region

tab FRS18
gen region=0 if FRS18==1
replace region=1 if FRS18==2
lab var region "Region"
lab def wo 0 "West Germany" 1 "East Germany"
lab val region wo
tab region

*/ value orientations (Inglehart)

tab1 FR2A FR2B
gen postmat=0 if FR2A>0 & FR2A<5 & FR2B>0 & FR2B<5
replace postmat=1 if (FR2A==2 & FR2B==4) | (FR2A==4 & FR2B==2)
gen mat=0 if FR2A>0 & FR2A<5 & FR2B>0 & FR2B<5
replace mat=1 if (FR2A==1 & FR2B==3) | (FR2A==3 & FR2B==1)
lab var postmat "Postmaterialism" 
lab var mat "Materialism"
lab def yesno 0 no 1 yes
lab val postmat yesno
lab val mat yesno
tab1 mat postmat

*/ party identification

tab FR36
gen spdpid=0 if FR36>0 & FR36<13
replace spdpid=1 if FR36==1
gen cdupid=0 if FR36>0 & FR36<13
replace cdupid=1 if FR36==2|FR36==3
gen fdppid=0 if FR36>0 & FR36<13
replace fdppid=1 if FR36==5
gen grepid=0 if FR36>0 & FR36<13
replace grepid=1 if FR36==6
gen pdspid=0 if FR36>0 & FR36<13
replace pdspid=1 if FR36==7
lab var spdpid "SPD-identifier"
lab var cdupid "CDU/CSU-identifier"
lab var fdppid "FDP-identifier"
lab var grepid "Greens-identifier"
lab var pdspid "PDS-identifier"
lab val spdpid yesno
lab val cdupid yesno
lab val fdppid yesno
lab val grepid yesno
lab val pdspid yesno
tab1 spdpid-pdspid

*/ ideology


tab FR28
gen lr=(FR28-1)/10
lab var lr "Left-right ideology"
lab def leri 0 left 1 right
lab val lr leri
tab lr

*/ gender

gen gender=2-FRS19
lab var gender "Gender"
lab def sex 0 male 1 female
lab val gender sex
tab gender

*/ age 

gen age=ALTER
lab var age "Age"
tab age

*/ education

gen educ=0 if FRS16>0 & FRS16<7
replace educ=1 if FRS16==5|FRS16==6
lab var educ "Education"
lab def educ1 0 "without high-school diploma" 1 "with high-school diploma"
lab val educ educ1
tab educ


*/ personality traits

tab1 FR41_21-FR41_60

*/ examining the internal consistency of the personality scales

*/ Openness

alpha FR41_58 FR41_53 FR41_48 FR41_43 FR41_38 FR41_33 FR41_28 FR41_23 FR41_18 FR41_13 FR41_8 FR41_3 if region>-1 & region<2, std

*/ Conscientiousness

alpha FR41_60 FR41_55 FR41_50 FR41_45 FR41_40 FR41_35 FR41_30 FR41_25 FR41_20 FR41_15 FR41_10 FR41_5 if region>-1 & region<2, std

*/ Extroversion

alpha FR41_57 FR41_52 FR41_47 FR41_42 FR41_37 FR41_32 FR41_27 FR41_22 FR41_17 FR41_12 FR41_7 FR41_2 if region>-1 & region<2, std

*/ Agreeableness

alpha FR41_59 FR41_54 FR41_49 FR41_44 FR41_39 FR41_34 FR41_29 FR41_24 FR41_19 FR41_14 FR41_9 FR41_4 if region>-1 & region<2, std


*/ Neuroticism

alpha FR41_56 FR41_51 FR41_46 FR41_41 FR41_36 FR41_31 FR41_26 FR41_21 FR41_16 FR41_11 FR41_6 FR41_1 if region>-1 & region<2, std

*/ reversing items

gen FR41_55a=6-FR41_55
gen FR41_45a=6-FR41_45
gen FR41_30a=6-FR41_30
gen FR41_15a=6-FR41_15
gen FR41_48a=6-FR41_48
gen FR41_38a=6-FR41_38
gen FR41_33a=6-FR41_33
gen FR41_23a=6-FR41_23
gen FR41_18a=6-FR41_18
gen FR41_8a=6-FR41_8
gen FR41_3a=6-FR41_3
gen FR41_59a=6-FR41_59
gen FR41_54a=6-FR41_54
gen FR41_44a=6-FR41_44
gen FR41_39a=6-FR41_39
gen FR41_29a=6-FR41_29
gen FR41_24a=6-FR41_24
gen FR41_14a=6-FR41_14
gen FR41_9a=6-FR41_9
gen FR41_46a=6-FR41_46
gen FR41_31a=6-FR41_31
gen FR41_16a=6-FR41_16
gen FR41_1a=6-FR41_1
gen FR41_57a=6-FR41_57
gen FR41_42a=6-FR41_42
gen FR41_27a=6-FR41_27
gen FR41_12a=6-FR41_12

*/ counting the number of missing values

egen miss1=rowmiss (FR41_60 FR41_55 FR41_50 FR41_45 FR41_40 FR41_35 FR41_30 FR41_25 FR41_20 FR41_15 FR41_10 FR41_5)
egen miss2=rowmiss (FR41_58 FR41_53 FR41_48 FR41_43 FR41_38 FR41_33 FR41_28 FR41_23 FR41_18 FR41_13 FR41_8 FR41_3)
egen miss3=rowmiss (FR41_59 FR41_54 FR41_49 FR41_44 FR41_39 FR41_34 FR41_29 FR41_24 FR41_19 FR41_14 FR41_9 FR41_4)
egen miss4=rowmiss (FR41_57 FR41_52 FR41_47 FR41_42 FR41_37 FR41_32 FR41_27 FR41_22 FR41_17 FR41_12 FR41_7 FR41_2)
egen miss5=rowmiss (FR41_56 FR41_51 FR41_46 FR41_41 FR41_36 FR41_31 FR41_26 FR41_21 FR41_16 FR41_11 FR41_6 FR41_1)

*/ creating the personality scales

egen CS2=rowmean (FR41_60 FR41_55a FR41_50 FR41_45a FR41_40 FR41_35 FR41_30a FR41_25 FR41_20 FR41_15a FR41_10 FR41_5) if miss1<4
egen AG2=rowmean (FR41_59a FR41_54a FR41_49 FR41_44a FR41_39a FR41_34 FR41_29a FR41_24a FR41_19 FR41_14a FR41_9a FR41_4) if miss2<4
egen OP2=rowmean (FR41_58 FR41_53 FR41_48a FR41_43 FR41_38a FR41_33a FR41_28 FR41_23a FR41_18a FR41_13 FR41_8a FR41_3a) if miss3<4
egen NC2=rowmean (FR41_56 FR41_51 FR41_46a FR41_41 FR41_36 FR41_31a FR41_26 FR41_21 FR41_16a FR41_11 FR41_6 FR41_1a) if miss5<4
egen EX2=rowmean (FR41_57a FR41_52 FR41_47 FR41_42a FR41_37 FR41_32 FR41_27a FR41_22 FR41_17 FR41_12a FR41_7 FR41_2) if miss4<4

gen CS=(CS2-1)/4
gen OP=(OP2-1)/4
gen AG=(AG2-1)/4
gen NC=(NC2-1)/4
gen EX=(EX2-1)/4

lab var CS "Conscientiousness"
lab var OP "Openness"
lab var AG "Agreeableness"
lab var NC "Neuroticism"
lab var EX "Extroversion"

*/ Summary statistics (Table 3 in the text)

sum OP CS EX AG NC if region==0|region==1 [aw=GEWICHT]

*/ Comment: excluding all cases with any missing value decreases the number of cases by 10 to 20 but does not alter the substantive results of my analysis

*/ b) dependent variables

gen iraq=FR29_1/6
gen euro=1-FR29_3/6
gen buwe=1-FR29_5/6
gen eugov=1-FR29_7/6
lab var iraq "War in Iraq"
lab var euro "Introduction of the Euro"
lab var buwe "German army (Bundeswehr)"
lab var eugov "European government"
lab def issue1 0 "strongly reject" 1 "strongly support"
lab val iraq issue1
lab val euro issue1
lab val buwe issue1
lab val eugov issue1
tab1 iraq-eugov

*/ Summary statistics (Table 4 in the text)

sum euro eugov buwe iraq if region==0|region==1 [aw=GEWICHT]

*/ 2. Analysis (Table 5 in the text)

*/ demographics and political predispositions

regress euro gender age region educ postmat mat lr spdpid cdupid grepid fdppid pdspid  [pweight=GEWICHT] if educ>-1 & educ<2 & lr>-1 & lr<2 & spdpid>-1 & spdpid<2 & OP<2 & AG<2 & CS<2
fitstat
regress eugov gender age region educ postmat mat lr spdpid cdupid grepid fdppid pdspid  [pweight=GEWICHT] if educ>-1 & educ<2 & lr>-1 & lr<2 & spdpid>-1 & spdpid<2 & OP<2 & AG<2 & CS<2
fitstat
regress buwe gender age region educ postmat mat lr spdpid cdupid grepid fdppid pdspid  [pweight=GEWICHT] if educ>-1 & educ<2 & lr>-1 & lr<2 & spdpid>-1 & spdpid<2 & OP<2 & AG<2 & CS<2
fitstat
regress iraq gender age region educ postmat mat lr spdpid cdupid grepid fdppid pdspid  [pweight=GEWICHT] if educ>-1 & educ<2 & lr>-1 & lr<2 & spdpid>-1 & spdpid<2 & OP<2 & AG<2 & CS<2
fitstat

*/ demographics, political predispositions, and three personality traits

regress euro OP AG CS gender age region educ postmat mat lr spdpid cdupid grepid fdppid pdspid  [pweight=GEWICHT] if educ>-1 & educ<2 & lr>-1 & lr<2 & spdpid>-1 & spdpid<2 & OP<2 & AG<2 & CS<2
fitstat
regress eugov OP AG CS gender age region educ postmat mat lr spdpid cdupid grepid fdppid pdspid  [pweight=GEWICHT] if educ>-1 & educ<2 & lr>-1 & lr<2 & spdpid>-1 & spdpid<2 & OP<2 & AG<2 & CS<2
fitstat
regress buwe OP AG CS gender age region educ postmat mat lr spdpid cdupid grepid fdppid pdspid  [pweight=GEWICHT] if educ>-1 & educ<2 & lr>-1 & lr<2 & spdpid>-1 & spdpid<2 & OP<2 & AG<2 & CS<2
fitstat
regress iraq OP AG CS gender age region educ postmat mat lr spdpid cdupid grepid fdppid pdspid  [pweight=GEWICHT] if educ>-1 & educ<2 & lr>-1 & lr<2 & spdpid>-1 & spdpid<2 & OP<2 & AG<2 & CS<2
fitstat

*/ demographics (adj. r-squareds shown in Table 5)

regress euro gender age region educ [pweight=GEWICHT] if lr>-1 & lr<2 & spdpid>-1 & spdpid<2 & postmat>-1 & postmat<2 & OP<2 & AG<2 & CS<2
fitstat
regress eugov gender age region educ [pweight=GEWICHT] if lr>-1 & lr<2 & spdpid>-1 & spdpid<2 & postmat>-1 & postmat<2 & OP<2 & AG<2 & CS<2
fitstat
regress buwe gender age region educ [pweight=GEWICHT] if lr>-1 & lr<2 & spdpid>-1 & spdpid<2 & postmat>-1 & postmat<2 & OP<2 & AG<2 & CS<2
fitstat
regress iraq gender age region educ [pweight=GEWICHT] if lr>-1 & lr<2 & spdpid>-1 & spdpid<2 & postmat>-1 & postmat<2 & OP<2 & AG<2 & CS<2
fitstat


*/ personality traits and demographics (adj. r-squareds shown in Table 5)

regress euro OP AG CS gender age region educ [pweight=GEWICHT] if lr>-1 & lr<2 & spdpid>-1 & spdpid<2 & postmat>-1 & postmat<2 
fitstat
regress eugov OP AG CS gender age region educ [pweight=GEWICHT] if lr>-1 & lr<2 & spdpid>-1 & spdpid<2 & postmat>-1 & postmat<2
fitstat
regress buwe OP AG CS gender age region educ [pweight=GEWICHT] if lr>-1 & lr<2 & spdpid>-1 & spdpid<2 & postmat>-1 & postmat<2 
fitstat
regress iraq OP AG CS gender age region educ [pweight=GEWICHT] if lr>-1 & lr<2 & spdpid>-1 & spdpid<2 & postmat>-1 & postmat<2 
fitstat

*/ personality traits only (adj. r-squareds shown in Table 5)

regress euro OP AG CS [pweight=GEWICHT] if lr>-1 & lr<2 & spdpid>-1 & spdpid<2 & postmat>-1 & postmat<2 & educ>-1 & educ<2 & region>-1 & region <2
fitstat
regress eugov OP AG CS [pweight=GEWICHT] if lr>-1 & lr<2 & spdpid>-1 & spdpid<2 & postmat>-1 & postmat<2 & educ>-1 & educ<2 & region>-1 & region <2
fitstat
regress buwe OP AG CS [pweight=GEWICHT] if lr>-1 & lr<2 & spdpid>-1 & spdpid<2 & postmat>-1 & postmat<2 & educ>-1 & educ<2 & region>-1 & region <2
fitstat
regress iraq OP AG CS [pweight=GEWICHT] if lr>-1 & lr<2 & spdpid>-1 & spdpid<2 & postmat>-1 & postmat<2 & educ>-1 & educ<2 & region>-1 & region <2
fitstat


*/ controls and five personality traits (not shown in the text)

regress euro OP AG CS EX NC gender age region educ postmat mat lr spdpid cdupid grepid fdppid pdspid  [pweight=GEWICHT] if educ>-1 & educ<2 & lr>-1 & lr<2 & spdpid>-1 & spdpid<2
fitstat
regress eugov OP AG CS EX NC gender age region educ postmat mat lr spdpid cdupid grepid fdppid pdspid  [pweight=GEWICHT] if educ>-1 & educ<2 & lr>-1 & lr<2 & spdpid>-1 & spdpid<2
fitstat
regress buwe OP AG CS EX NC gender age region educ postmat mat lr spdpid cdupid grepid fdppid pdspid  [pweight=GEWICHT] if educ>-1 & educ<2 & lr>-1 & lr<2 & spdpid>-1 & spdpid<2
fitstat
regress iraq OP AG CS EX NC gender age region educ postmat mat lr spdpid cdupid grepid fdppid pdspid  [pweight=GEWICHT] if educ>-1 & educ<2 & lr>-1 & lr<2 & spdpid>-1 & spdpid<2
fitstat


